package cn.fl.ass.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.DecimalUtils;
import cn.fl.ass.vo.AssDealSellCostVO;
import fl.ass.facade.dto.AssDealSellCostDTO;


 /**
 * @Description: 处置-变卖费用信息表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class AssDealSellCostVOTransform {


	/**
	 * DTO 转  VO
	 * @param po AssDealSellCostDTO
	 * @return AssDealSellCostVO
	 */
	public static AssDealSellCostVO toVO(AssDealSellCostDTO dto) {
		AssDealSellCostVO  vo = null;
		if (dto != null) { 
			vo = new AssDealSellCostVO();
			vo.setId(dto.getId());
			vo.setDetailId(dto.getDetailId());//拖车信息明细ID
			vo.setCostMainCd(dto.getCostMainCd());//费用大类 - ASS0017
			vo.setCostSubCd(dto.getCostSubCd());//费用小类 - ASS0017
			vo.setCostAmt(dto.getCostAmt());//费用金额
			vo.setCostRem(dto.getCostRem());//备注
			vo.setIsDel(dto.getIsDel());//是否删除 1-删除 0-正常
			vo.setCostAmtDouble(dto.getCostAmt()==null?null:DecimalUtils.convertFenToYuan(dto.getCostAmt()));

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto AssDealSellCostVO
	 * @return AssDealSellCostDTO
	 */
	public static AssDealSellCostDTO toDTO(AssDealSellCostVO vo) {
		AssDealSellCostDTO dto = null;
		if (vo != null) {
			dto = new AssDealSellCostDTO();
			dto.setId(vo.getId());
			dto.setDetailId(vo.getDetailId());//拖车信息明细ID
			dto.setCostMainCd(vo.getCostMainCd());//费用大类 - ASS0017
			dto.setCostSubCd(vo.getCostSubCd());//费用小类 - ASS0017
			dto.setCostAmt(vo.getCostAmt());//费用金额
			dto.setCostRem(vo.getCostRem());//备注
			dto.setIsDel(vo.getIsDel());//是否删除 1-删除 0-正常

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<AssDealSellCostDTO>
	 * @return List<AssDealSellCostVO>
	 */
	public static List<AssDealSellCostVO> toVOList(List<AssDealSellCostDTO> list) {
		List<AssDealSellCostVO>  voList = new ArrayList<AssDealSellCostVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssDealSellCostDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<AssDealSellCostVO>
	 * @return List<AssDealSellCostDTO>
	 */
	public static List<AssDealSellCostDTO> toDTOList(List<AssDealSellCostVO> list) {
		List<AssDealSellCostDTO>  dtoList = new ArrayList<AssDealSellCostDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssDealSellCostVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
